# _*_ encoding:utf-8 _*_

from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response

from goods.models import SPUSpecification
from meiduo_admin.serializers.spec_serializers import SpecModelSerializer
from meiduo_admin.paginations import MyPage


class SPUSpecView(ModelViewSet):

    permission_classes = [IsAdminUser]

    queryset = SPUSpecification.objects.all()
    serializer_class = SpecModelSerializer
    pagination_class = MyPage

    def new_list(self, request):
        queryset = self.queryset
        serializer = self.get_serializer(queryset, many=True)

        return Response(serializer.data)



